|
![](/i/fill.gif) |
>Pseudorandom numbers do repeat, but the period is very large. If you are
>seeing repetition, you are probably using the rand() function wrong.
>Give the real code, trimmed down to the minimum required to demonstrate
>the problem, but check the documentation first.
Well, I think I figured out what the problem was, but not exactly why it
was a problem. It seems that I was using the same variable to define which
stream I was using (#declare a = seed(15)) in the while loop, and then
using (#declare a = seed(40)) in a macro that I used within the while loop.
By changing one to a different variable name, I seem to have fixed the
problem...
But now I'm confused. I apologize for bothering you about this, but the
documentation wasn't very clear/understandable to me, so I was wondering
when and to what extent reusing variable names is acceptable, and how that
relates to what is going on when I define and use macros and/or other
objects. (Did that make sense ?) Also, if I call the macro repeatedly, does
the random number generator i'm using within the macro get reset each time
? What exactly goes on with the different rand-number streams when I seed
it, and later call em ?
Thanks.
Vidya
Post a reply to this message
|
![](/i/fill.gif) |